<div style="width:520px; float:left;">

    <div class="block">
        <h2>Search Restaurants:</h2><br />
        <?= $this->formSearch->setAction($this->commonUrl . '/place/search'); ?>
        <!-- <strong>Find a zip code <a href="javascript:App.findZip('/dine_dev_roman/public/dine/index.php/find-zip');">here</a></strong> -->
    </div>

    <!--recent reviews box start here-->
    <?php if (count($this->reviews) > 0) { ?>
    <div class="block">
        <p>Recent reviews <a href="<?= $this->L('review', 'list'); ?>">More</a></p>
        <br />
        <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <thead>
                <tr>
                    <th>Restaurant Name</th>
                    <th>Reviewer</th>
                    <th align="center">Rating</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($this->reviews as $rev) { ?>
                <tr>
                    <td>
                        <a href="<?= $this->L('place', 'view', array('id' => $rev['user_id'])); ?>"><?= $rev['place_name'] ?></a>
                    </td>
                    <td width="120px">
                        <img src="<?= $this->commonUrl; ?>/images/profile_avatar.jpg" width="23" height="23" alt="#" />
                        <a href="<?= $this->L('profile', 'view', array('user_id' => $rev['user_id'])); ?>"><?= $rev['firstname'] ?> <?= $rev['lastname'] ?></a>
                    </td>
                    <td>
                        <div class="rating" data="<?= $rev['rating'] ?>_<?= $rev['id'] ?>"></div>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <?= $rev['description'] ?>
                    </td>
                </tr>
                <?php } ?>
            </tbody>
        </table>
    </div>
    <?php } ?>

    <?php if (count($this->restaurants) > 0) { ?>
    <div class="block">
        <p>Top Restaurants <a href="/dine_dev_roman/public/dine/index.php/top-places-in">More</a></p>
        <br />
        <div>
            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                <thead>
                    <tr>
                        <th>Restaurant Name</th>
                        <th>Address</th>
                        <th>Status</th>
                        <th>Reviews</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($this->restaurants as $res) { ?>
                    <tr>
                        <td>
                            <a href="<?= $this->L('place', 'view', array('id' => $res['id'])); ?>"><?= $res['name'] ?></a>
                        </td>
                        <td>
                            <p><?= $res['address'] ?><br /><?= $res['city_name'] ?>, <?= $res['state_code'] ?> <?= $res['zip'] ?></p>
                        </td>
                        <td>
                            <div class="rating" data="<?= $res['rating'] ?>_<?= $res['id'] ?>"></div>
                        </td>
                        <td align="center">
                            <a href="<?= $this->L('place', 'view', array('id' => $res['id'])); ?>"><?= $res['review_count'] ?></a>
                        </td>
                    </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
    </div>
    <?php } ?>

</div>

<div style="width:280px; float:left; margin-left:20px;">
    <div class="block">
        <p>Top Reviews (<a href="<?= $this->L('review', 'list-reviewers'); ?>">More</a>)</p><br />
        <?php
        foreach ($this->topReviewers as $t) {
            $profileLink = $this->L('profile', 'view', array('user_id' => $t['id']));
            $reviewLink = $this->L('review', 'list-by-user', array('user_id' => $t['id']));
        ?>
            <div>
                <span class="user_item">
                    <a href="<?= $this->L('profile', 'view', array('user_id' => $t['id'])); ?>">
                        <img src="<?= $this->commonUrl; ?>/images/profile_avatar.jpg" height="40" alt="#" />
                    </a>
                    <p><a href="<?= $profileLink ?>"><?= $t['firstname'] ?> <?= $t['lastname'] ?></a></p>
                    <p><a href="<?= $reviewLink ?>"><?= $t['review_count'] ?> Reviews</a></p>
                </span>
            </div>
            <br />
        <?php } ?>
    </div>

    <div class="block">
        <a href="<?= $this->L('place', 'add'); ?>">Add restaurant</a><br /><br />
        <a href="#">Build</a> <span>you own restaurant website for free</span><br /><br />
        <a href="<?= $this->L('place'); ?>">Browse</a> <span>our most recent</span>
    </div>

</div>



<script type="text/javascript">
$('.rating').jRating({
    decimalLength:2,
    rateMax : 5,
    bigStarsPath : '<?= $this->commonUrl; ?>/images/stars.png',
    smallStarsPath : '<?= $this->commonUrl; ?>/images/small.png',
    //phpPath : 'php/jRating.php',
    isDisabled : true,
    onSuccess : function() {
        alert('Success : your rate has been saved :)');
    },
    onError : function() {
        alert('Error : please retry');
    }

});
</script>